<?php
ini_set('display_errors', 'on');
error_reporting(E_ALL);

set_include_path(realpath('../') . PATH_SEPARATOR . get_include_path());

// include simpletest classes
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
require_once 'simpletest/mock_objects.php';

require_once 'Q/Rule/Interface.php';
require_once 'Q/Filter/Interface.php';
require_once 'Q/Rule/Set.php';
require_once 'Q/Filter/Set.php';
require_once 'Q/Rule/Abstract.php';
require_once 'Q/Filter/Abstract.php';

require_once 'Q/Rule/Alnum.php';
require_once 'Q/Rule/Alpha.php';
require_once 'Q/Rule/Digits.php';
require_once 'Q/Rule/Email.php';
require_once 'Q/Rule/Exception.php';
require_once 'Q/Rule/InArray.php';
require_once 'Q/Rule/Interface.php';
require_once 'Q/Rule/Length.php';
require_once 'Q/Rule/Match.php';
require_once 'Q/Rule/NotNull.php';
require_once 'Q/Rule/Range.php';
require_once 'Q/Rule/RegExp.php';
require_once 'Q/Rule/Set.php';

require_once 'Tests/Q/Rule.php';
require_once 'Tests/Q/Filter.php';

require_once 'Tests/Mock/Q/Rule.php';
require_once 'Tests/Mock/Q/Filter.php';

// run tests in html reporter
$test = new GroupTest('All Library Tests');
$test->addTestCase(new Tests_Q_Rule);
$test->addTestCase(new Tests_Q_Filter);

if (TextReporter::inCli()) {
    exit ($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());